/**
 * CONCENTRÉ // Xml entreprise grade framework 
 *
 * @fileoverview	Concentré
 * @author			Sébastien CRAMATTE <scramatte@zensoluciones.com> 
 * @version			$Release$ - $Revision: 161 $
 * 
 * Please visit these sites for details :
 * http://concentre.zensoluciones.com 
 * http://code.google.com/p/concentre-xforms
 * 
 * License: GPL v2 or later (http://www.gnu.org/licenses/gpl.html)
 *
 * Copyright (C) 2004-2006 Sébastien Cramatte <scramatte(at)zensoluciones(dot)com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

var scriptPath     = null;
var headElement		 = null;
var ua = null;

var userAgent = {
	name : null,
	regexps: {'opera':/\bOpera\b/,'ie':/\bMSIE\b/,'gecko':/\bGecko\b/,'konqueror':/\b(Konqueror|KHTML)\b/,'safari':/\bSafari\b/},

	get: function () {
		if (userAgent.name) return userAgent.name;
		
		for (var r in userAgent.regexps) {
			if (navigator.userAgent.match(userAgent.regexps[r])) { 
				userAgent.name = r; 
				return r; 
			};
		}
	}
};

function include(src) {
  var scriptElement = document.createElement("script");
  scriptElement.setAttribute("type", "text/javascript");
  scriptElement.setAttribute("src",  src);
  scriptElement.setAttribute("defer", "true");
  headElement.appendChild (scriptElement);
}

  window.onload = function () {
	Concentre.initialize();   
  };


(function(scripts) {

  var scriptElements = document.getElementsByTagName("script");
  
  for (var i = scriptElements.length; --i>=0; ) {
    var scriptElement = scriptElements[i];
    var source        = scriptElement.getAttribute("src");
    
    if (source != null && source.match(/^(.*\/)?concentre(\.js|-gzip\.php)$/)) {
      scriptPath = RegExp.$1;
      break;
    }
  }

  headElement = document.getElementsByTagName("head")[0];
  userAgent.get();

  for (var i=scripts.length; --i>=0;) {
		//console.log(scripts[i]);
	    include(scriptPath + scripts[i]);
  };

})(
	[
		"modules/XForms/Element/Action/Toggle.js",
		"modules/XForms/Element/Action/Setvalue.js",
		"modules/XForms/Element/Action/Abstract.js",
		"modules/XForms/Element/Control/Case.js",
		"modules/XForms/Element/Control/Repeat.js",
		"modules/XForms/Element/Control/Switch.js",
		"modules/XForms/Element/Control/Trigger.js",
		"modules/XForms/Element/Control/Group.js",
		"modules/XForms/Element/Control/Label.js",
		"modules/XForms/Element/Control/Item.js",
		"modules/XForms/Element/Control/Select1.js",
		"modules/XForms/Element/Control/Select.js",
		"modules/XForms/Element/Control/Submit.js",
		"modules/XForms/Element/Control/Textarea.js",
		"modules/XForms/Element/Control/Secret.js",
		"modules/XForms/Element/Control/Input.js",
		"modules/XForms/Element/Control/Output.js",
		"modules/XForms/Element/Control/Abstract.js",
		"modules/XForms/Element/Head/Bind.js",
		"modules/XForms/Element/Head/Submission.js",
		"modules/XForms/Element/Head/Instance.js",
		"modules/XForms/Element/Head/Model.js",
		"modules/XForms/Element/Head/Abstract.js",
		"modules/XForms/Element/Abstract.js",
		"modules/XForms/Binding.js",
		"modules/XForms.js",
		"factory/events.js",
		"factory/i18n.js",
		"factory/xslt.js",
		"factory/xml.js",
		"common/XPath.js",
		"common/Array.js",
		"common/QName.js",
		"dependencyGraph.js",
		"core.js"
	]
);

